public class Thread1 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
           while (!Thread.currentThread().isInterrupted()){
               System.out.println("Thread is working!");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   e.printStackTrace();
                   break;
               }
           }
            System.out.println("The Thread is over!");
        });
        t.start();
        Thread.sleep(3000);
        System.out.println("让 t 结束进程!");
        t.interrupt();
    }

}
